/**
 * Created by shudong.msd(风骐) on 2016/4/17.
 */
app.filter('orderObjectBy', function() {
    <!--items为排序前元素,其中field为排序关键字,reverse表示为逆序(desc)-->
    return function(items, field, reverse) {
        var filtered = [];
        angular.forEach(items, function(item) {
            filtered.push(item);
        });
        filtered.sort(function (a, b) {
            return (a[field] > b[field] ? 1 : -1);
        });
        if(reverse) {
            filtered.reverse();
        }
        return filtered;
    };
});
